json.result   true
json.message  "获取收藏成功."
json.data     @favorites do |favorite|
  if favorite.favoriteable_type == 'Spu'
    if not favorite.favoriteable.blank?
      json.id                 favorite.id
      json.spu          do
        json.id                 favorite.favoriteable.id
        json.name               favorite.favoriteable.name
        json.sales_volume       favorite.favoriteable.sales_volume
        json.avatar             favorite.favoriteable.avatar.url
        json.description        favorite.favoriteable.description
        json.published          favorite.favoriteable.published
        json.promotion          favorite.favoriteable.promotion
        json.seven_day_back     favorite.favoriteable.seven_day_back
        json.genuine_product    favorite.favoriteable.genuine_product
        json.low_promotion_price          favorite.favoriteable.low_promotion_price
        json.high_promotion_price         favorite.favoriteable.high_promotion_price
        json.low_sale_price     favorite.favoriteable.low_sale_price
        json.high_sale_price    favorite.favoriteable.high_sale_price
        json.low_cost_price     favorite.favoriteable.low_cost_price
        json.high_cost_price    favorite.favoriteable.high_cost_price
      end
    end
  elsif favorite.favoriteable_type == 'Shop'
    if not favorite.favoriteable.blank?
      json.id                 favorite.id
      json.shop          do
        json.id             favorite.favoriteable.id
        json.name           favorite.favoriteable.name
        json.avatar         favorite.favoriteable.avatar.url
        json.province       favorite.favoriteable.province.name
        json.city           favorite.favoriteable.city.name
        json.district       favorite.favoriteable.district.name
        json.phone          favorite.favoriteable.phone
        json.longitude      favorite.favoriteable.longitude
        json.latitude       favorite.favoriteable.latitude
        json.stars          favorite.favoriteable.stars
      end
    end
  elsif favorite.favoriteable_type == 'Brand'
    if not favorite.favoriteable.blank?
      json.id                 favorite.id
      json.brand          do
        json.id         favorite.favoriteable.id
        json.name       favorite.favoriteable.name
        json.avatar     favorite.favoriteable.avatar.url
      end
    end
  end
end